*Dear reader,

*If you have any questions about the dofile or the data, do not hesitate to contact me.

*Best regards,

*Rasmus Skytte

clear all
use "Data_observational.dta"

***Creating needed variables*

*Creating party ID variables*
rename partyid Party_ID
label variable Party_ID "Generally speaking, do you usually think of yourself as a..."
label define PartID 1 "Strong Republican" 2 "Republican" 3 "Independent leaning Republican" 4 "Independent" 5 "Independent leaning Democrat" 6 "Democrat" 7 "Strong Democrat" 8 "Something else" 9 "Don't know"
label values Party_ID PartID
gen Dem0_or_Rep1 = .
replace Dem0_or_Rep1 = 0 if (Party_ID == 7 | Party_ID == 6 | Party_ID == 5)
replace Dem0_or_Rep1 = 1 if (Party_ID == 1 | Party_ID == 2 | Party_ID == 3)
label variable Dem0 "Dummy variable for Party ID"
label define DumPart 1 "Republican_incl_leaners" 0 "Democrat_incl_leaners"
label values Dem0 DumPart

***Creating varibales for perceived polarization***
replace jobs_r = . if jobs_r == 8
replace jobs_d = . if jobs_d == 8
gen Per_pol_Jobs_stdofliving =  (jobs_r - jobs_d)/6
replace environment_r = . if environment_r == 8
replace environment_d = . if environment_d == 8
gen Per_pol_Bus_Environ = (environment_r - environment_d)/6
replace defense_spend_r = . if defense_spend_r == 8
replace defense_spend_d = . if defense_spend_d == 8
gen Per_pol_Defense = (defense_spend_r - defense_spend_d)/6
gen Per_pol_issue = (Per_pol_Jobs_stdofliving + Per_pol_Bus_Environ + Per_pol_Jobs_stdofliving)/3

***Creating variable for perceived incivility***
gen per_inc_mutz = ((perceived_incivility_1 + perceived_incivility_2 + perceived_incivility_3 + perceived_incivility_4 + perceived_incivility_5 - 5)/5/8*(-1))+1

***Creating varibales for trust***
replace trust1 = . if trust1 == 5
replace trust2 = . if trust2 == 10
gen TrustIndex = ((((trust1-1)/3 + (trust2-1)/8)/2)*(-1))+1

***Creating varibales for attitudes***
replace defense_spend_own = . if defense_spend_own == 8
replace environment_own = . if environment_own == 8
replace jos_own = . if jos_own == 8
gen att_index = (defense_spend_own-1 + environment_own-1 + jos_own-1)/6/3
gen int1 = Dem0_or_Rep1 * per_inc_mutz
gen int2 = Dem0_or_Rep1 * Per_pol_issue

***Creating varibales for affective polarization***
replace word_d_m = . if word_d_m == 6
replace word_d_i = . if word_d_i == 6
replace word_d_s = . if word_d_s == 6
replace word_r_m = . if word_r_m == 6
replace word_r_i = . if word_r_i == 6
replace word_r_s = . if word_r_s == 6
gen demat = (word_d_m + (word_d_i*(-1)+6) + word_d_s - 3)/4/3
gen repat = (word_r_m + (word_r_i*(-1)+6) + word_r_s - 3)/4/3
gen afpolwords = demat - repat if Dem0_or_Rep1 == 0
replace afpolwords = repat - demat if Dem0_or_Rep1 == 1
gen afpoltherm = (therm_dem - therm_rep)/100 if Dem0_or_Rep1 == 0
replace afpoltherm = (therm_rep - therm_dem)/100 if Dem0_or_Rep1 == 1
gen afpolcommon = (afpolwords + afpoltherm)/2

***Creating control variables***
gen Soctrust = (soctrust-1)/10 if soctrust != 12
gen Interest = (pol_int-1)/3*(-1)+1
replace perc_e = . if perc_e == 8
gen PastEconomy = (perc_e-1)/6*(-1)+1
gen IDstrength = .
replace IDstrength = 0 if Party_ID == 4
replace IDstrength = 0.333 if Party_ID == 5
replace IDstrength = 0.333 if Party_ID == 3
replace IDstrength = 0.666 if Party_ID == 6
replace IDstrength = 0.666 if Party_ID == 2
replace IDstrength = 1 if Party_ID == 7
replace IDstrength = 1 if Party_ID == 1

***labeling variables***
label variable per_inc_mutz "Perceived incivility (0 - 1)"
label variable Per_pol_issue "Perceived issue polarization (-1 - 1)"
label variable Soctrust "Social trust (0 - 1)"
label variable Interest "Political interest (0 - 1)"
label variable PastEc "Perception of economy (0 - 1)"
label variable IDstrength "Strength of party ID (0 - 1)"
label variable int1 "Republican * Perceived incivility"
label variable int2 "Republican * Perceived issue pol."
label variable Dem0_or_Rep1 "Republican (dummy)"
label variable TrustIndex "Trust in politicians (0 - 1)"
label variable att_index "Political attitudes (-1 - 1)"
label variable afpolcommon "Affective polarization (-1 - 1)"

***Reliability check reported in section called "Follow-up study 3: Leaving the experimental setting"*

*Dependent variables*
alpha afpolwords afpoltherm, std item
alpha environment_own defense_spend_own jos_own, std item
alpha trust1 trust2, std item

*Independent variables*
alpha Per_pol_Jobs_stdofliving Per_pol_Bus_Environ Per_pol_Defense, std item
alpha perceived_incivility_1 perceived_incivility_2 perceived_incivility_3 perceived_incivility_4 perceived_incivility_5, std item

***Results reported in Table 1 and Appendix 13***

*Trust*
reg TrustIndex Per_pol_issue per_inc_mutz Soctrust Interest PastEconomy IDstrength, rob
reg TrustIndex per_inc_mutz Soctrust Interest PastEconomy IDstrength if Per_pol_issue != ., rob 
reg TrustIndex Per_pol_issue Soctrust Interest PastEconomy IDstrength, rob

*Attitude polarization*
reg att_index int2 int1 per_inc_mutz Per_pol_issue Dem0_or_Rep1 Soctrust Interest PastEconomy, rob 
reg att_index int1 per_inc_mutz Dem0_or_Rep1 Soctrust Interest PastEconomy IDstrength if Per_pol_issue != ., rob 
reg att_index int2 Per_pol_issue Dem0_or_Rep1 Soctrust Interest PastEconomy IDstrength, rob

*Affective pol*
reg afpolcommon Per_pol_issue per_inc_mutz Soctrust Interest PastEconomy IDstrength, rob
reg afpolcommon per_inc_mutz Soctrust Interest PastEconomy IDstrength if Per_pol_issue != ., rob
reg afpolcommon Per_pol_issue Soctrust Interest PastEconomy IDstrength, rob